﻿Public Class frmOrderManage
  Private m_NameWidth As Integer = 100
  Private m_ManufacturerWidth As Integer = 100
  Private m_ModelWidth As Integer = 150
  Private m_SerialWidth As Integer = 100
  Private m_SetupDateWidth As Integer = 150
  Private m_LocationWidth As Integer = 200
  Private m_StatusWidth As Integer = 50
  Private m_InstallationDateWidth As Integer = 120
  Private m_StopDatyWidth As Integer = 80
  Private m_ErrorNameWidth As Integer = 150
  Private m_ErrorCodeWidth As Integer = 100

  Private Sub frmOrderManage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		dgvOrderList.DataSource = Nothing
		Dim SQLString As String = "SELECT * FROM tbl_orders"
		Dim dtAccess As DataBaseAccess = New DataBaseAccess()
		Dim dtTable As DataTable = dtAccess.GetDataTable(SQLString)
		dgvOrderList.DataSource = dtTable
		'HeadofGrid()
	End Sub

	Private Sub HeadofGrid()
		With dgvOrderList

			'Column 0
			.Columns(0).Name = "ID"
			.Columns(0).Width = 0
			.Columns(0).Visible = False
			.Columns(0).ReadOnly = True

			'Column 1
			.Columns(1).HeaderText = "Machine Name"
			.Columns(1).Name = "Name"
			.Columns(1).Width = m_NameWidth
			.Columns(1).ReadOnly = True
			.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill

			'Column 2
			.Columns(2).HeaderText = "Manufacture"
			.Columns(2).Name = "Manufacture"
			.Columns(2).Width = m_ManufacturerWidth
			.Columns(2).ReadOnly = True
			.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill

			'Column 3
			.Columns(3).HeaderText = "Model"
			.Columns(3).Name = "Model"
			.Columns(3).Width = m_ModelWidth
			.Columns(3).ReadOnly = True

			'Column 4
			.Columns(4).HeaderText = "Serial"
			.Columns(4).Name = "Serial"
			.Columns(4).Width = m_SerialWidth
			.Columns(4).ReadOnly = True

			'Column 5
			.Columns(5).HeaderText = "Date Installation"
			.Columns(5).Name = "SetupDate"
			.Columns(5).Width = m_InstallationDateWidth
			.Columns(5).ReadOnly = True

			'Column 6
			.Columns(6).HeaderText = "Location"
			.Columns(6).Name = "Location"
			.Columns(6).Width = m_LocationWidth
			.Columns(6).ReadOnly = True

			'Column 7
			.Columns(7).HeaderText = "Status"
			.Columns(7).Name = "Status"
			.Columns(7).Width = m_StatusWidth
			.Columns(7).ReadOnly = True

		End With
	End Sub
End Class